<?php
/**
 * 显示主题列表
 * 
 * @todo
 * @author Judas <judasnow@gmail.com>
 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
 */
session_start();
include('path.php') ;
require_once( SOJ_ROOT.'/include/function/lib.php');

require_once('Pager.php');

$tpl = new my_smarty();
$tpl->assign( 'active' , 'questions'  );

if ( !empty( $_SESSION['username'] ) ){
	
	$tpl->assign( 'username' , $_SESSION['username'] );	
}

try{
	$db = db_connect();
	$topics = topic_process::get_all( $db );
/*
	//此配置应该可以由配置文件读出
	$params = array(
    		'itemData' => $topics,
    		'perPage' => 30,
    		'delta' => 8,             
    		'append' => true,
    		'clearIfVoid' => false,
    		'urlVar' => 'entrant',
    		'useSessions' => true,
    		'closeSession' => true,
    		'mode'  => 'Jumping',
	);
	
	$pager = & Pager::factory($params);
	$page_data = $pager->getPageData();
	$links = $pager->getLinks();

	$tpl->assign( 'topics' , $page_data );
	$tpl->assign( 'links' , $links['all'] );
 */
	$tpl->assign( 'topics' , $topics );
}catch( Exception $e ){

	 exception_handle( $e ) ;
}

$tpl->display('topic_list.tpl');
